import router from './router'
import store from './store'
import NProgress from 'nprogress'
import 'nprogress/nprogress.css'

NProgress.configure({ showSpinner: false }) 


router.beforeEach(async(to,from,next) => {
  const token = localStorage.getItem("token")
  if (token) {
    let res = await store.dispatch('user/getLoginStatus')
    console.log('user/getLoginStatus:', res)
    next()
  }
  next()
})

router.afterEach(() => {
  NProgress.done()
})
